package Operation;

import book.Booklist;
import book.*;

import java.util.Scanner;

public class AddOperation implements IOperation{
    @Override
    public void work(Booklist booklist) {
        System.out.println("新增图书");
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入书名");
        String name =sc.nextLine();
        System.out.println("请输入作者");
        String author =sc.nextLine();
        System.out.println("请输入价格");
        int price = sc.nextInt();
        sc.nextLine();
        System.out.println("请输入类型");
        String type =sc.nextLine();
        Book book = new Book(name,author,price,type);
        int currentsize = booklist.getUsedSize();
        booklist.setBooks(currentsize,book);
        booklist.setUsedSize(currentsize+1);
    }
}
